<?php

$CLFetchers->fetchLstDataHeader($Db,
                                $jobId,
                                $SourceDb,
                                $nHeader,
                                $lstHeader);

$_POST["trDateEnt"]     = date("d-m-Y",
                               strtotime($lstHeader["TR_DATE"][0]));

$_POST["fromEnt"]       = $lstHeader["FROM_WHS"][0];
$_POST["toEnt"]         = $lstHeader["TO_WHS"][0];
$_POST["modelEnt"]      = $lstHeader["MODEL"][0];
$_POST["qtyEnt"]        = $lstHeader["QTY"][0];
$_POST["memoEnt"]       = $lstHeader["MEMO"][0];

$CFetchers->fetchLstDataDetail($Db,
                               $jobId,
                               $SourceDb->fetchValue("srcDbDtl"),
                               $nDetail,
                               $lstDetail);

for($iRow = 0; $iRow < $nDetail; $iRow++){

  $_POST["snEnt"][$iRow] = $lstDetail["SN"][$iRow];
}

echo  "<table border='1' class='dedeq' >\n".
      "<tr>\n".

        "<th> DATE </th>
            <td > ".date("d-m-Y",
                         strtotime($lstHeader["TR_DATE"][0]))." </td> \n".

      "</tr>\n".
      "<tr>\n".

        "<th> From </th><td> ".$lstHeader["FROM_WHS"][0]." </td>\n".

      "</tr>\n".
      "<tr>\n".

        "<th> To   </th><td> ".$lstHeader["TO_WHS"][0]." </td>\n".

      "</tr>\n".
      "</tr>\n".

        "<th> Model </th><td> ".$lstHeader["MODEL"][0]." </td>\n".

      "</tr>\n".
      "</tr>\n".

        "<th> Qty   </th><td> ".number_format($lstHeader["QTY"][0],
                                              2,
                                              ".",
                                              ",")." </td>\n".

      "</tr>\n".
      "</tr>\n".

        "<th> Memo  </th><td> ".$lstHeader["MEMO"][0]." </td>\n".

      "</tr>\n".
      "</table><br/>\n";

echo  "<table border='1' class='dedeq'>\n".
      "<tr>\n".
      "<th> No   </th>\n".
      "<th> SN   </th>\n".
      "</tr>\n";

for($iRow = 0; $iRow < $_SESSION["init_num"]; $iRow++){

  echo  "<tr>\n".

          "<td> ".($iRow + 1)." </td>\n".

          "<td> ".$lstDetail["SN"][$iRow]." </td>\n".

        "</tr>\n";
}

echo  "</table><br/>\n";

?>